package zh.dummy.netty.core.protocol;

public enum ErrorType {
	SUCCESS("成功",(byte)200),
	REPEATED_LOGIN("重复登录",(byte)1),
	ILLEGAL_LOGIN("非法登录",(byte)2);

	private String name;
	private byte value;
	
	ErrorType(String name,byte value){
		this.setName(name);
		this.setValue(value);
	}
	
	public byte value() {
		return this.value;
	}
	
	
	public String getName() {
		return name;
	}
	
	public static String getName(byte type){
		for(ErrorType errorType : ErrorType.values()){
			if(errorType.value() == type){
				return errorType.name;
			}
		}
		return "未知错误";
	}

	public void setName(String name) {
		this.name = name;
	}

	public byte getValue() {
		return value;
	}

	public void setValue(byte value) {
		this.value = value;
	}
	
}
